#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 100010;
double a[N], s[N];
int n, F;
bool check(double avg)
{
    double minv = 0;
    for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i] - avg;
    for (int k = F; k <= n; k++)
    {
        minv = min(minv, s[k - F]);
        if (s[k] - minv >= 0) return true;
    }
    return false;
}
int main()
{
    cin >> n >> F;
    double l = 0, r = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        r = max(r, a[i]);
    }
    while (r - l > 1e-5)
    {
        double mid = (l + r) / 2;
        if (check(mid)) l = mid;
        else r = mid;
    }
    printf("%d\n", (int)(r * 1000));
    return 0;
}